﻿using System;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.nodes.mssql;

namespace SharpSqlAnalyzer.stmt.mssql
{
	// Token: 0x02000185 RID: 389
	public class TMssqlSet : TCustomSqlStatement
	{
		// Token: 0x06000DA7 RID: 3495 RVA: 0x00308EC0 File Offset: 0x003070C0
		public TMssqlSet(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstmssqlset;
		}

		// Token: 0x06000DA8 RID: 3496 RVA: 0x00308ED4 File Offset: 0x003070D4
		internal override void buildsql()
		{
		}

		// Token: 0x06000DA9 RID: 3497 RVA: 0x00308ED6 File Offset: 0x003070D6
		internal override void clear()
		{
		}

		// Token: 0x06000DAA RID: 3498 RVA: 0x00308ED8 File Offset: 0x003070D8
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x06000DAB RID: 3499 RVA: 0x00308EDF File Offset: 0x003070DF
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x1700027D RID: 637
		// (get) Token: 0x06000DAC RID: 3500 RVA: 0x00308EE1 File Offset: 0x003070E1
		// (set) Token: 0x06000DAD RID: 3501 RVA: 0x00308EE9 File Offset: 0x003070E9
		public virtual TExpressionList Variable_expr_list
		{
			get
			{
				return this.variable_expr_list;
			}
			set
			{
				this.variable_expr_list = value;
			}
		}

		// Token: 0x1700027E RID: 638
		// (get) Token: 0x06000DAE RID: 3502 RVA: 0x00308EF2 File Offset: 0x003070F2
		// (set) Token: 0x06000DAF RID: 3503 RVA: 0x00308EFA File Offset: 0x003070FA
		public virtual TExpression VarExpr
		{
			get
			{
				return this.varExpr;
			}
			set
			{
				this.varExpr = value;
			}
		}

		// Token: 0x1700027F RID: 639
		// (get) Token: 0x06000DB0 RID: 3504 RVA: 0x00308F03 File Offset: 0x00307103
		// (set) Token: 0x06000DB1 RID: 3505 RVA: 0x00308F0B File Offset: 0x0030710B
		public virtual TObjectName VarName
		{
			get
			{
				return this.varName;
			}
			set
			{
				this.varName = value;
			}
		}

		// Token: 0x17000280 RID: 640
		// (get) Token: 0x06000DB2 RID: 3506 RVA: 0x00308F14 File Offset: 0x00307114
		// (set) Token: 0x06000DB3 RID: 3507 RVA: 0x00308F1C File Offset: 0x0030711C
		public virtual TFunctionCall XmlMethod
		{
			get
			{
				return this.xmlMethod;
			}
			set
			{
				this.xmlMethod = value;
			}
		}

		// Token: 0x17000281 RID: 641
		// (get) Token: 0x06000DB4 RID: 3508 RVA: 0x00308F25 File Offset: 0x00307125
		// (set) Token: 0x06000DB5 RID: 3509 RVA: 0x00308F2D File Offset: 0x0030712D
		public virtual TSelectSqlStatement Subquery
		{
			get
			{
				return this.subquery;
			}
			set
			{
				this.subquery = value;
			}
		}

		// Token: 0x17000282 RID: 642
		// (get) Token: 0x06000DB6 RID: 3510 RVA: 0x00308F36 File Offset: 0x00307136
		// (set) Token: 0x06000DB7 RID: 3511 RVA: 0x00308F3E File Offset: 0x0030713E
		public virtual int SetType
		{
			get
			{
				return this.setType;
			}
			set
			{
				this.setType = value;
			}
		}

		// Token: 0x06000DB8 RID: 3512 RVA: 0x00308F48 File Offset: 0x00307148
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			TMssqlSetSqlNode tmssqlSetSqlNode = null;
			if (this.rootNode is TMssqlSetSqlNode)
			{
				tmssqlSetSqlNode = (TMssqlSetSqlNode)this.rootNode;
			}
			else if (this.rootNode is TMssqlStmtStubSqlNode)
			{
				TMssqlStmtStubSqlNode tmssqlStmtStubSqlNode = (TMssqlStmtStubSqlNode)this.rootNode;
			}
			base.doParseStatement(psql);
			if (tmssqlSetSqlNode != null)
			{
				this.setType = tmssqlSetSqlNode.SetType;
			}
			else
			{
				this.setType = 3;
			}
			switch (this.setType)
			{
			case 1:
				this.varName = tmssqlSetSqlNode.VarName;
				this.varExpr = tmssqlSetSqlNode.VarExpr;
				this.varExpr.doParse(this, ESqlClause.setVariable);
				break;
			case 2:
				this.varName = tmssqlSetSqlNode.VarName;
				this.subquery = new TSelectSqlStatement(this.dbvendor);
				this.subquery.rootNode = tmssqlSetSqlNode.Subquery;
				this.subquery.doParseStatement(this);
				break;
			case 4:
				this.xmlMethod = tmssqlSetSqlNode.XmlMethod;
				this.xmlMethod.doParse(this, ESqlClause.unknown);
				break;
			case 5:
				this.variable_expr_list = tmssqlSetSqlNode.Variable_expr_list;
				this.variable_expr_list.doParse(this, ESqlClause.setVariable);
				break;
			}
			return 0;
		}

		// Token: 0x06000DB9 RID: 3513 RVA: 0x0030907A File Offset: 0x0030727A
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000DBA RID: 3514 RVA: 0x0030908A File Offset: 0x0030728A
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x04001315 RID: 4885
		private TObjectName varName;

		// Token: 0x04001316 RID: 4886
		private TExpression varExpr;

		// Token: 0x04001317 RID: 4887
		private TExpressionList variable_expr_list;

		// Token: 0x04001318 RID: 4888
		private TFunctionCall xmlMethod;

		// Token: 0x04001319 RID: 4889
		private TSelectSqlStatement subquery;

		// Token: 0x0400131A RID: 4890
		private int setType;
	}
}
